<?php

/**
 * Assoplatform form base class.
 *
 * @method Assoplatform getObject() Returns the current form's model object
 *
 * @package    explications_informatiques
 * @subpackage form
 * @author     Guimezanes Cyrille
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseAssoplatformForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'idassoplatform'   => new sfWidgetFormInputHidden(),
      'id_article'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Articles'), 'add_empty' => false)),
      'id_major'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Platform'), 'add_empty' => true)),
      'id_version_major' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Plateformversiongroup_5'), 'add_empty' => true)),
      'id_minor'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Platform_4'), 'add_empty' => true)),
      'id_version_minor' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Plateformversiongroup'), 'add_empty' => true)),
      'view_by_mode'     => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'idassoplatform'   => new sfValidatorChoice(array('choices' => array($this->getObject()->get('idassoplatform')), 'empty_value' => $this->getObject()->get('idassoplatform'), 'required' => false)),
      'id_article'       => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Articles'))),
      'id_major'         => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Platform'), 'required' => false)),
      'id_version_major' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Plateformversiongroup_5'), 'required' => false)),
      'id_minor'         => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Platform_4'), 'required' => false)),
      'id_version_minor' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Plateformversiongroup'), 'required' => false)),
      'view_by_mode'     => new sfValidatorString(array('max_length' => 1, 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('assoplatform[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Assoplatform';
  }

}
